home *** CD-ROM | disk | FTP | other *** search
- #ifndef __DAEMONAPP__
- #define __DAEMONAPP__
-
- #ifndef __CLIST__
- #include <CList.h>
- #endif
-
- #ifndef __TYPES__
- #include <Types.h>
- #endif
- #ifndef __APPLEEVENTS__
- #include <AppleEvents.h>
- #endif
- #ifndef __PROCESSES__
- #include <Processes.h>
- #endif
-
- extern "C" {
- pascal OSErr DoAEOpenApplication(AppleEvent *messagein, AppleEvent *reply, long refIn);
- pascal OSErr DoAEOpenDocuments(AppleEvent *messagein, AppleEvent *reply, long refIn);
- pascal OSErr DoAEPrintDocuments(AppleEvent *messagein, AppleEvent *reply, long refIn);
- pascal OSErr DoAEQuitApplication(AppleEvent *messagein, AppleEvent *reply, long refIn);
-
- pascal void NMResponseProc(NMRec* theNote);
-
- pascal void InitUDaemonApp(long stacksize);
-
- pascal void TopLevelFail(short e, long m, void* staticLink);
- }
-
- class NoteItem : public CItem {
- public:
- NMRec* fNote;
-
- NoteItem() { fNote = nil; }
- NoteItem(NMRec* note) { fNote = note; }
- virtual ~NoteItem() { if (fNote->nmResp) fNote->nmResp(fNote); }
- };
-
- class NoteList : public CList {
- public:
- NoteItem* GetItem(NMRec* note);
- };
-
- class DaemonApp {
- public:
- Boolean fQuit;
-
- EventRecord fERecord;
- short fEventMask;
- unsigned long fMySleep;
- RgnHandle fMouseRgn;
-
- ProcessSerialNumber fPSN;
- long fA5;
-
- NoteList fNoteList;
- long fEndWait;
-
- DaemonApp();
- virtual ~DaemonApp();
-
- virtual void Initialize();
-
- virtual void InitToolBox();
- virtual void InstallAEHandlers();
-
- virtual void PostNotification(char* str);
-
- virtual void Run();
- virtual void DoNull() { }
- virtual void DoQuit();
-
- virtual void SetSleepValue(unsigned long sleep) { fMySleep = sleep; }
- virtual void SetEventMask(short mask) { fEventMask = mask; }
- virtual void SetMouseRgn(RgnHandle rgn) { fMouseRgn = rgn; }
- virtual void SetEndWaitTime(long ticks) { fEndWait = ticks; }
-
- virtual void DoHighLevel(EventRecord *AERecord);
- };
-
- extern DaemonApp* gDaemon;
-
- #endif